package com.quanquan.store.repository;

import com.quanquan.store.entity.StoreLabel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @ClassName:StoreLabelRepository
 * @Description:TODO
 * @Author:xiongjunbao
 * @Date:2019/7/19 10:19
 * @Version 1.0
 */
public interface StoreLabelRepository extends JpaRepository<StoreLabel, String> {

    /**
     * 查找商户对应所有有效的标签
     *
     * @return
     */
    @Query(value = "select * from oo_store_label where status_remove = 0 and status_show = 0 and store_id = ?1",nativeQuery = true)
    List<StoreLabel> findByStoreId(String storeId);


    /**
     * 查找商户对应所有有效的标签
     *
     * @return
     */
    @Query(value = "select * from oo_store_label where store_id = ?1 and status_remove = 0",nativeQuery = true)
    List<StoreLabel> findByStoreIdManageent(String storeId);

    /**
     * 查找商户对应所有有效的标签
     *
     * @return
     */
    @Query(value = "select * from oo_store_label where status_remove = 0 and label_id = ?1",nativeQuery = true)
    List<StoreLabel> findByLabelId(String labelId);

}
